<!--
 * @description  :作废单据
 * @descriptionDetail:作废单据
 * @copyright    : 浙江烟草
 * @author       : dw
 * @create       : 2022-12-28 15:38:30
-->
<template>
  <view class="single-page">
    <theme-navbar
      :isBack="false"
      :is-white="false"
      title="作废原因"
      style="z-index: 99999;"
    >
      <view class="nav-right-icon" @click="handlerConfirm">
        确定
      </view>
    </theme-navbar>
    <view class="content">
      <u-input type="textarea" v-model="memo" placeHolder="请输入..."></u-input>
    </view>
  </view>
</template>

<script>
import storeService from '@/service/store/store.service.js';
export default {
  props: {
    billId: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      memo:'',
    };
  },
  methods: {
    // 确认
    handlerConfirm () {
      let param = {
        billId: this.billId,
        memo:this.memo,
      }
      if(this.$u.test.isEmpty(this.memo)) return this.$u.toast('请输入作废原因！')
      this.$modal.showLoading('作废中...');
      storeService.destoryBill(param).then(res => {
        this.$modal.hideLoading();
        if(res.success) {
          this.$emit("confirm", 'true');
        } else{
          this.$u.toast(res.msg);
        }
      }).catch(e => {
        console.log(e);
        this.$modal.hideLoading();
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.single-page {
  padding: 10px;
  .nav-right-icon {
    color: #FFF;
    margin-right: 15px;
  }

}
</style>
